

#include <iostream>
#include"Client.h"
#include "boost\scoped_ptr.hpp"
#include "boost\thread.hpp"
#include <fstream>

int main(int argc, char * argv[])
{
	if ( argc != 5) return 0;

	ServerInfo server;

	std::ifstream file(argv[3]);
	std::string task;
	char line[1024];
	while(!file.eof())
	{
		file.getline(line,1024);
		task += (std::string(line) + "\n" );
	}

	std::cout<<"Wczytany plik: "<<std::endl;
	std::cout<<task<<std::endl;

	server.address.ip.str = argv[1];
	server.address.socet = atoi(argv[2]);
	TaskInfo taskInfo;
	boost::shared_ptr<Client> client[20];
	for(int i =0; i < atoi(argv[4]); i++)
	{
		client[i]	= boost::shared_ptr<Client> (new Client(server));
		client[i]->sendTask(task);
		client[i]->start();
		boost::this_thread::sleep(boost::posix_time::seconds(1));
	}
	
	



	system("pause");
	
	return 0;
}